U.S. voting behavior over time (1916-2016). How competitive are U.S. presidential elections?

The objective of this project is to create a set of graphs that comply with the principles of good data visualization: namely, the charts should be insightful, but also simple enough for readers to digest the main message of each exhibit.

Main product: A self-contained Shiny app shows how the number “swing states” hinges on what we choose to count as a competitive election (at the state level). Most data journalists and researchers use data for recent elections; the app present will allow you to look at patterns for the last 25 U.S. presidential elections.

Access the set of visualizations via shinyapp.io, or see the animations below.

Product 2: Using sankey plots, display county-level vote changes between 2012 and 2016. The user can choose to focus on a particular state, or to select counties that meet a specific condition.

Third, I represent recent election results, with ggplot.

How many states were competitive between 1916 and 2016?

How common were landslides?

In various election, victories by more than a 20% margin wre common in many states:

Check the app to explore the pattern for yourself, or to determine which elections were unusual (or when a particular party had an especially difficult year).

See also: charts/republican_vote_margin.gif).

How many Democratic counties turned red in 2016?

In what states were the blue counties least secure?

Election visualization with ggplot

Add charts here…

Background information

The first part of the shiny all is built with highcharter. In addition to shiny, shinythemes, RColorBrewer and tidyverse are used.

The second part relies on sankeyNetwork from the networkD3 library. The last section uses datatable from the DT library.

This html document was built with R markdown.

The project is hosted on Github where my website is generated with Hugo.

Data

I have collected and reshaped Democratic and Republican vote share data for most U.S. states between 1916 and 2016 from DataPlanet / U.S. Elections Atlas. If we interactively modify what thresholds count as “close results”, how has the proportion of “swing states” changed over time? You can find out using my Shiny App.

References